#!/bin/sh

# postgres must be trust
# export PGPASSWORD=12345

dropdb -U postgres nstat
dropuser -U postgres mcs
createuser -U postgres -s mcs
createdb -U postgres -O mcs nstat
psql -U postgres nstat < ../test/set_password.sql
psql -U postgres nstat < ../test/schema.sql
psql -U postgres nstat < ../test/domain.sql
psql -U postgres nstat < ../test/generate_dbenums.sql
psql -U postgres nstat < ../test/sr_param_shift.sql
psql -U postgres nstat < ../test/sr_report.sql
psql -U postgres nstat < ../test/sr_reporttypes.sql
psql -U postgres nstat < ../test/sr_shift.sql
psql -U postgres nstat < ../test/sr_title.sql
psql -U postgres nstat < ../test/srp1_cans.sql
psql -U postgres nstat < ../test/srp1_goods.sql
psql -U postgres nstat < ../test/srp1_noz.sql
psql -U postgres nstat < ../test/srp2_expense.sql
psql -U postgres nstat < ../test/srp2_receipt.sql
psql -U postgres nstat < ../test/srp3_dept.sql
psql -U postgres nstat < ../test/srp3_diverg.sql
psql -U postgres nstat < ../test/srp3_overflow.sql
psql -U postgres nstat < ../test/srp3_saldo.sql
psql -U postgres nstat < ../test/fsale_goods.sql
psql -U postgres nstat < ../test/fsale_petrol.sql
psql -U postgres nstat < ../test/tms_report.sql
psql -U postgres nstat < ../test/prt_bonus_salling.sql
psql -U postgres nstat < ../test/prt_nctlist.sql
psql -U postgres nstat < ../test/prt_nctsum.sql
psql -U postgres nstat < ../test/prt_refunds4tpk.sql
psql -U postgres nstat < ../test/goods_move_by_storage.sql
psql -U postgres nstat < ../test/ecr_report.sql
psql -U postgres nstat < ../test/petrol_move.sql
psql -U postgres nstat < ../test/fttn_goods.sql
psql -U postgres nstat < ../test/mcr_rest_goods.sql
psql -U postgres nstat < ../test/mcr_reval_goods.sql
psql -U postgres nstat < ../test/mcs_articles.sql
psql -U postgres nstat < ../test/mcs_shifts.sql
psql -U postgres nstat < ../test/fact_tech_delivery.sql

cp ../test/nodes.conf /etc/sync
cp ../test/sync.conf /etc/sync
